<script language="Javascript" type="text/javascript">
    function SelectMoveRows(SS1, SS2)
    {
        var SelID = '';
        var SelText = '';
        // Move rows from SS1 to SS2 from bottom to top
        for (i = SS1.options.length - 1; i >= 0; i--)
        {
            if (SS1.options[i].selected == true)
            {
                SelID = SS1.options[i].value;
                SelText = SS1.options[i].text;
                var newRow = new Option(SelText, SelID);
                SS2.options[SS2.length] = newRow;
                SS1.options[i] = null;
            }
        }
        //SelectSort(SS2);
    }
    function SelectSort(SelList)
    {
        var ID = '';
        var Text = '';
        for (x = 0; x < SelList.length - 1; x++)
        {
            for (y = x + 1; y < SelList.length; y++)
            {
                if (SelList[x].text > SelList[y].text)
                {
                    // Swap rows
                    ID = SelList[x].value;
                    Text = SelList[x].text;
                    SelList[x].value = SelList[y].value;
                    SelList[x].text = SelList[y].text;
                    SelList[y].value = ID;
                    SelList[y].text = Text;
                }
            }
        }
    }

    function select_all(form)
    {
        var elem = form.elements['n_comuna2'];

        for (i = 0; i < elem.length; i++)
        {
            elem[i].selected = true;
        }
    }
</script>
<?php
include_once '../../class/classFormulario.php';
$formulario = new formulario();

include_once '../../class/classUtils.php';
$utils = new Utils();
if ($_GET["id_region"] > 0) {
//obtener array de comunas
    $LST_COMUNAS = array();
    $LST_COMUNAS = $utils->obtenerComunasRegion($_GET["id_region"]);
    ?>
    <script language="javascript" type="text/javascript" src="../../js/ajax.js"></script>
    <script type="text/javascript" language="javascript">
        cargarComunas_usuario('div_regiones', this.value);
    </script>
    <div class="fieldRow rightRow" id="div_comunas">
        <label >Comuna: </label>
        <?php echo @$formulario->combobox($LST_COMUNAS, "comuna_ine", $comuna_ine, "Seleccione Comuna", ""); ?>
    </div>
    <?php
} else {
    echo "<div class=\"alerta\">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspDebe seleccionar una regi&oacute;n</div><br/>";
    exit();
}
?>